package com.example.assignment5.controll;

import com.example.assignment5.exception.R;
import com.example.assignment5.sub;
import com.example.assignment5.service.supService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/supplier")
public class supController {

    @Autowired
    private supService supplierService;

    @GetMapping("/{id}")
    private R getById(@PathVariable Long id){
        return R.success(supplierService.getById(id));
    }

    @PostMapping
    private R add(@RequestBody sub supplier){
        supplierService.add(supplier);
        return R.success("添加成功");
    }
}
